load("@fbsource//tools/build_defs:fb_native_wrapper.bzl", "fb_native")
load("@prelude//cfg/modifier:conditional_modifier.bzl", "conditional_modifier")

oncall("build_infra")

# This is for testing `conditional_modifier` rule builds. The bxl tests will test that the produced values
# do what we expect them to do for modifier resolution

fb_native.constraint_setting(name = "test")

fb_native.constraint_value(
    name = "test1",
    constraint_setting = ":test",
)

fb_native.constraint_value(
    name = "test2",
    constraint_setting = ":test",
)

conditional_modifier(
    name = "test_conditional_modifier",
    modifier = {
        # Test different types of relative target labels for modifiers
        "DEFAULT": ":test1",
        "ovr_config//os:linux": "//buck2/tests/e2e/configurations/cfg_constructor/conditional_modifier:test2",
    },
)

conditional_modifier(
    name = "test_nested_conditional_modifier",
    modifier = {
        "DEFAULT": {
            "ovr_config//cpu:arm64": ":test2",
            "ovr_config//cpu:x86_64": ":test1",
        },
        "ovr_config//os:linux": None,
    },
)
